package com.ag.work.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.ag.bean.TbPropose;
import com.ag.common.IDUtil;
import com.ag.common.IIDService;
import com.ag.work.dao.ProposeDAO;
import com.ag.work.service.IProposeService;

public class ProposeServiceImpl implements IProposeService {

	private static final Log log = LogFactory.getLog(ProposeServiceImpl.class);
	@Resource(name = "iDServiceImpl")
	private IIDService idServiceImpl;
	private ProposeDAO proposeDAO;
	
	@Override
	public boolean save(TbPropose propose) {
		propose.setPpId(idServiceImpl.findTablePK(IDUtil.TB_PROPOSE));
		propose.setPaTime(new Date());
		propose.setA(IDUtil.PRESERVE);
		propose.setF("1");
		this.proposeDAO.save(propose);
		return false;
	}

	@Override
	public List find(String UId) {	
		log.info("find satrt:--------");
		log.info("dao-------"+this.proposeDAO.find(UId));
		return this.proposeDAO.find(UId);
		
		/*String cql = "from TbProposeRecord ps join fetch ps.tbPropose where ";
		if (UId!=null&&UId.length() > 0){
			cql += " ps.id.UId = " + UId;
		}
		List result = null;
		try {
			result = proposeDAO.find1(cql);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("------------------------------------");	
		System.out.println("result  = " + result.size());
		return result;*/

	}
	
	public IIDService getIdServiceImpl() {
		return idServiceImpl;
	}

	public void setIdServiceImpl(IIDService idServiceImpl) {
		this.idServiceImpl = idServiceImpl;
	}

	public ProposeDAO getProposeDAO() {
		return proposeDAO;
	}

	public void setProposeDAO(ProposeDAO proposeDAO) {
		this.proposeDAO = proposeDAO;
	}

	

}
